package org.diysearch.helpers;

import org.diysearch.tools.BaseTool;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;

public abstract class MailHelper {
	public static void send(String rcpt, String from, String subject,
			String body) throws Exception 
	{
		JavaMailSender sender = (JavaMailSender) BaseTool.IOC_ENGINE.getBean("mailSender");
		SimpleMailMessage message = new SimpleMailMessage();
		message.setFrom(from);
		message.setTo(rcpt);
		message.setSubject(subject);
		message.setText(body);
		
		try {
			sender.send(message);
		} catch (Exception ex) {
			throw ex;
		}
		
	}
}
